/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package finaloptativa;

import com.mysql.jdbc.Connection;
import com.mysql.jdbc.Statement;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author Jose Ortiz
 */
public class FinalOptativa {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        try {
            long t=System.currentTimeMillis();
            Connection conn = (Connection) DriverManager.getConnection("jdbc:mysql://SQL09.FREEMYSQL.NET/optmailserver?"+"user=optmail&password=ucuenca314");
            Statement stmt = (Statement) conn.createStatement();
            //boolean rs = stmt.execute("create table acmp (id int, data varchar(100))");
            //boolean rs = stmt.execute("insert into acmp (id, data) values (3, 'dsf')");
            //rs = stmt.execute("insert into acmp (id, data) values (4, 'ptds')");
            //rs = stmt.execute("insert into acmp (id, data) values (5, 'msdfds')");
            //rs = stmt.execute("insert into acmp (id, data) values (6, 'sdfsdf')");
            ResultSet a = stmt.executeQuery("select id, data from acmp");
            a.next();
            System.out.println(a.getInt("id")+","+a.getString("data"));
            a.next();
            System.out.println(a.getInt("id")+","+a.getString("data"));
            System.out.println("T = "+(System.currentTimeMillis()-t)/1000);
        } catch (SQLException ex) {
            System.out.println(ex);
            Logger.getLogger(FinalOptativa.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
}
